package br.usp.ime.macmovel.android;

import java.util.ArrayList;

import android.graphics.drawable.Drawable;

import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;

/**
 * This class draws icons on the map. Used to draw a location map for the libraries on the library map activity.
 */
public class USPItemizedOverlay extends ItemizedOverlay<OverlayItem> {
    /**
     * Creates a new USPItemizedOverlay with the defaultMarker given.
     */
	public USPItemizedOverlay(Drawable defaultMarker) {
		super(boundCenterBottom(defaultMarker));
	}

	private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();

    /**
     * Creates an icon.
     */
	@Override
	protected OverlayItem createItem(int i) {
	  return mOverlays.get(i);
	}

    /**
     * Returns the number of icons of this overlay.
     */
	@Override
	public int size() {
		return mOverlays.size();
	}
	
    /**
     * Adds an overlay item to this overlay.
     */
	public void addOverlay(OverlayItem overlay) {
	    mOverlays.add(overlay);
	    populate();
	}
}
